Skip to content

TNTP-3334: IPROTO_IS_SYNC support for begin/commit #447

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 3, 2025

Conversation

bigbes
Copy link

@bigbes bigbes commented Jun 27, 2025

Implement BeginRequest.IsSync(bool) and CommitRequest.IsSync(bool).

Refactor Body methods of all Requests, do not use fillXXX functions.

Part of TNTP-3334
Closes #366

@bigbes bigbes force-pushed the bigbes/TNTP-3334-iproto-is-sync-support branch 5 times, most recently from 5f1d4dc to 4357337 Compare June 30, 2025 14:57
@bigbes bigbes requested review from dmyger and oleg-jukovec June 30, 2025 14:58
@bigbes bigbes marked this pull request as ready for review June 30, 2025 15:00
@bigbes bigbes force-pushed the bigbes/TNTP-3334-iproto-is-sync-support branch from 4357337 to c74d03f Compare June 30, 2025 15:03
@oleg-jukovec
Copy link
Collaborator

Closes #TNTP-3334

->

Part of #TNTP-3334

@bigbes bigbes force-pushed the bigbes/TNTP-3334-iproto-is-sync-support branch 3 times, most recently from 8892063 to f8f4d2d Compare July 1, 2025 12:55
example_test.go Outdated
conn := exampleConnect(dialer, opts)
defer conn.Close()

// Tarantool supports IS_SYNC flag for BeginRequest since version 3.1.0
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A comment should end with a dot.

Suggested change
// Tarantool supports IS_SYNC flag for BeginRequest since version 3.1.0
// Tarantool supports IS_SYNC flag for BeginRequest since version 3.1.0.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

example_test.go Outdated
conn := exampleConnect(dialer, opts)
defer conn.Close()

// Tarantool supports IS_SYNC flag for CommitRequest since version 3.1.0q
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// Tarantool supports IS_SYNC flag for CommitRequest since version 3.1.0q
// Tarantool supports IS_SYNC flag for CommitRequest since version 3.1.0.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

example_test.go Outdated
return
}

// Begin transaction
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// Begin transaction
// Begin transaction.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

example_test.go Outdated
return
}

// Insert in stream
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// Insert in stream
// Insert in stream.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

example_test.go Outdated
return
}

// Commit transaction in sync mode
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// Commit transaction in sync mode
// Commit transaction in sync mode.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

stream.go Outdated
baseRequest
txnIsolation TxnIsolationLevel
timeout time.Duration
isSync *bool
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's avoud a pointer here.

Suggested change
isSync *bool
isSync bool
isSyncExist bool

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

stream.go Outdated
@@ -137,6 +152,8 @@ func (req *BeginRequest) Context(ctx context.Context) *BeginRequest {
// Commit request can not be processed out of stream.
type CommitRequest struct {
baseRequest

isSync *bool
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The same.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

@bigbes bigbes force-pushed the bigbes/TNTP-3334-iproto-is-sync-support branch 2 times, most recently from dea5ad8 to 168a18a Compare July 2, 2025 10:19
@bigbes bigbes requested a review from oleg-jukovec July 2, 2025 11:04
@@ -171,8 +167,24 @@ func (req *ExecutePreparedRequest) Args(args interface{}) *ExecutePreparedReques
}

// Body fills an msgpack.Encoder with the execute request body.
func (req *ExecutePreparedRequest) Body(res SchemaResolver, enc *msgpack.Encoder) error {
return fillExecutePrepared(enc, *req.stmt, req.args)
func (req *ExecutePreparedRequest) Body(_ SchemaResolver, enc *msgpack.Encoder) error {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For here and all other functions.
Just a cosmetic: it would a bit better to add empty lines between blocks.
At least if we add linters from tt they will force add such lines.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

prepared.go Outdated
if err != nil {
return err
}
err = enc.EncodeUint(uint64(iproto.IPROTO_STMT_ID))
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
err = enc.EncodeUint(uint64(iproto.IPROTO_STMT_ID))
err = enc.EncodeUint(uint64(iproto.IPROTO_STMT_ID))

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

prepared.go Outdated
if err != nil {
return err
}
err = enc.EncodeUint(uint64(req.stmt.StatementID))
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
err = enc.EncodeUint(uint64(req.stmt.StatementID))
err = enc.EncodeUint(uint64(req.stmt.StatementID))

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

prepared.go Outdated
if err != nil {
return err
}
err = enc.EncodeUint(uint64(iproto.IPROTO_SQL_BIND))
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
err = enc.EncodeUint(uint64(iproto.IPROTO_SQL_BIND))
err = enc.EncodeUint(uint64(iproto.IPROTO_SQL_BIND))

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

if err != nil {
return err
}
return encodeSQLBind(enc, req.args)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return encodeSQLBind(enc, req.args)
return encodeSQLBind(enc, req.args)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

Copy link
Collaborator

@oleg-jukovec oleg-jukovec left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The dot is missed.

NB: all deleted tests were checking that functions passed from
constructor object to fillXXX function were passed in right order, so
removing them is not a problem

->

NB: all deleted tests were checking that functions passed from
constructor object to fillXXX function were passed in right order, so
removing them is not a problem.

bigbes added 2 commits July 3, 2025 10:20
NB: all deleted tests were checking that functions passed from
constructor object to fillXXX function were passed in right order, so
removing them is not a problem.
@bigbes bigbes force-pushed the bigbes/TNTP-3334-iproto-is-sync-support branch from 168a18a to 57d71e8 Compare July 3, 2025 07:22
Copy link
Collaborator

@oleg-jukovec oleg-jukovec left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, please don't forget to add a removed tests analogues in a next PR.

@oleg-jukovec oleg-jukovec merged commit fba773c into master Jul 3, 2025
24 of 26 checks passed
@oleg-jukovec oleg-jukovec deleted the bigbes/TNTP-3334-iproto-is-sync-support branch July 3, 2025 10:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support IPROTO_IS_SYNC
3 participants